import java.util.*;

/**
 * @author LKQ
 * @date 2022/3/10 9:35
 * @description 递归
 */
public class Solution {
    public static void main(String[] args) {

    }
    List<Integer> ans = new ArrayList<>();
    public List<Integer> preorder(Node root) {
        if(root == null) {
            return ans;
        }
        ans.add(root.val);
        for(Node n: root.children) {
            preorder(n);
        }
        return ans;
    }
}
